package com.wxg.tuan.canal;

import com.wxg.tuan.pojo.entity.Employee;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.xiaowu.behappy.canal.client.annotation.CanalTable;
import org.xiaowu.behappy.canal.client.handler.EntryHandler;


import java.util.logging.Logger;

/**
 * 本来用来演示:  监听tbl_user表
 * mysql同步到redis
 *
 * @author success
 * @date 2025/4/11 13:43:04
 */
@Slf4j
//@Component
//没启动canner就把@Component注释
@CanalTable("employee")
public class UserMysqlToRedis implements EntryHandler<Employee> {

    private Logger logger = Logger.getLogger(UserMysqlToRedis.class.getName());


    public void insert(Employee user) {
        logger.info("insert user: " + user);
    }


    public void update(Employee before, Employee after) {
        logger.info("update user: " + before );
        logger.info("after user: " + after );
    }


    public void delete(Employee user) {
        logger.info("delete user: " + user);
    }
}